home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Conversion / Convert_PICT / Source / UncommentedPSCode / Text < prev   
Text File  |  1994-05-24  |  5KB  |  291 lines

  1. %BEGIN Text
  2. /textY 0 def
  3. /textX 0 def
  4. /extraSpaceWidth 0 def
  5. /extraCharWidth 0 def
  6. /typeSize 12 def
  7. /Chicago findfont
  8. typeSize scalefont
  9. setfont
  10. /xscale 1 def
  11. /yscale 1 def
  12. /macBold false def
  13. /macItalic false def
  14. /macUnderline false def
  15. /macOutline false def
  16. /macShadow false def
  17. /macCondense false def
  18. /macExtend false def
  19. /textMode    /srcCopy    def
  20. /suppressText false def
  21. /textCenterX 0 def
  22. /textCenterY 0 def
  23. /textAngle 0 def
  24. /rotateText false def
  25. /drawChar
  26. {
  27.     textMatrix setmatrix
  28.     show
  29.     originalMatrix setmatrix
  30. }
  31. def
  32. /pathNonZero
  33. {
  34.     pathbbox
  35.     /top exch def
  36.     pop
  37.     /bottom exch def
  38.     pop
  39.     
  40.     top bottom sub  0 eq
  41.         {false}
  42.         {true}
  43.     ifelse
  44. }
  45. def
  46. /PICTshow
  47. {
  48.     /theString exch def
  49.     /y exch def
  50.     /x exch def
  51.     /extend 0 def        % extra space to widen each char
  52.     /charString 1 string def    % holds char as a string
  53.     suppressText false eq
  54.     {
  55.         gsave
  56.             rotateText true eq
  57.                 { textAngle rotate }
  58.             if
  59.         
  60.             /originalMatrix matrix currentmatrix def
  61.              /textMatrix
  62.                 xscale yscale matrix currentmatrix scale
  63.                 dup 3 
  64.                     matrix currentmatrix 3 get
  65.                 -1 mul put
  66.                 macItalic true eq
  67.                     { dup 2 .5 put }
  68.                 if
  69.             def
  70.             macBold true eq
  71.                 {/extend  extend 1.5 add def }
  72.             if
  73.             
  74.             macOutline true eq
  75.                 { /extend  extend 2 add def }
  76.             if
  77.         
  78.             macExtend true eq
  79.                 {/extend  extend 2 add def }
  80.             if
  81.         
  82.             macShadow true eq
  83.                 {/extend  extend 2 add def }
  84.             if
  85.         
  86.             macCondense true eq
  87.                 {/extend  extend 2 sub def }
  88.             if
  89.             foregroundColor    useColor
  90.             theString
  91.             {
  92.                 /theChar exch def
  93.                 charString 0 theChar put
  94.                 /charWidth charString stringwidth pop def % pop y dimen
  95.                 32 theChar eq
  96.                     { /extraSpace extraSpaceWidth def }
  97.                     { /extraSpace extraCharWidth def }
  98.                 ifelse
  99.                 macShadow true eq
  100.                 {
  101.                     x 2 add y 2 add moveto % move down & right to draw shadow
  102.                     charString drawChar
  103.                     macBold true eq
  104.                     {
  105.                         x 3 add y 2 add moveto
  106.                         charString drawChar
  107.                     }
  108.                     if
  109.                 }
  110.                 if
  111.                 /boldstep 0 def
  112.                 macBold true eq {2} {1} ifelse    % loop 2ce if bold is on.
  113.                 {
  114.                     macShadow true eq   macOutline true eq  or
  115.                     {
  116.                         newpath
  117.                         x boldstep add y moveto
  118.                         textMatrix setmatrix
  119.                         charString true charpath
  120.                         originalMatrix setmatrix
  121.                         pathNonZero true eq
  122.                         {
  123.                             1 setgray
  124.                             fill
  125.                             foregroundColor    useColor
  126.                             
  127.                             newpath
  128.                             x boldstep add y moveto
  129.                             textMatrix setmatrix
  130.                             charString false charpath
  131.                             originalMatrix setmatrix
  132.                             0 setlinewidth
  133.                             stroke
  134.                         }
  135.                         {
  136.                             x boldstep add y moveto
  137.                             charString drawChar
  138.                         }
  139.                         ifelse
  140.                     }
  141.                     { 
  142.                         x boldstep add y moveto
  143.                         charString drawChar
  144.                     }
  145.                     ifelse
  146.                     /boldstep boldstep 1 add def
  147.                 }
  148.                 repeat
  149.                 originalMatrix setmatrix
  150.         
  151.                 macUnderline true eq
  152.                 {
  153.                     x y 1 add moveto
  154.                     x charWidth add extraSpace add extend add y 1 add lineto
  155.                     1 setlinewidth
  156.                     stroke
  157.                 }
  158.                 if
  159.                 /x x charWidth add extraSpace extend add add def
  160.             }
  161.             forall
  162.         grestore
  163.     }
  164.     if    % if we were to suppress writing text out.
  165. }
  166. def
  167. /txFont
  168. {
  169.     /family exch def
  170.     family type /nametype eq
  171.     {
  172.         family findfont
  173.     }
  174.     {
  175.         family 134 eq
  176.             {/Linguistics findfont}
  177.             {family 149 eq
  178.                 {/NewOrleans findfont}
  179.                 {family 64 eq
  180.                     {/Davids findfont}
  181.                     {/Chicago findfont}   % default font
  182.                 ifelse}
  183.             ifelse}
  184.         ifelse
  185.     }
  186.     ifelse
  187.     
  188.     typeSize scalefont
  189.     setfont
  190. }
  191. def
  192. /txFace
  193. {
  194.     /styleArray exch def
  195.     /macBold false def
  196.     /macItalic false def
  197.     /macUnderline false def
  198.     /macOutline false def
  199.     /macShadow false def
  200.     /macCondense false def
  201.     /macExtend false def
  202.     styleArray
  203.     {
  204.         /style exch def
  205.         style /bold eq {/macBold true def}
  206.         {style /italic eq {/macItalic true def}
  207.         {style /underline eq {/macUnderline true def}
  208.         {style /outline eq {/macOutline true def}
  209.         {style /shadow eq {/macShadow true def}
  210.         {style /condense eq {/macCondense true def}
  211.         {style /extend eq {/macExtend true def}
  212.         {    % Actually, this is an error condition of some sort
  213.         } ifelse
  214.         } ifelse
  215.         } ifelse
  216.         } ifelse
  217.         } ifelse
  218.         } ifelse    
  219.         } ifelse    
  220.     }
  221.     forall
  222. }
  223. def
  224. /txMode
  225.     { /textMode exch def }
  226. def
  227. /spExtra
  228.     {/extraSpaceWidth exch def }
  229. def
  230. /txSize
  231. {
  232.     /newTypeSize exch def
  233.     currentfont
  234.         newTypeSize typeSize div scalefont
  235.     setfont
  236.     /typeSize newTypeSize def
  237. }
  238. def
  239. /txRatio
  240. {
  241.     /yscale exch def
  242.     /xscale exch def
  243. }
  244. def
  245. /chExtra
  246.     {pop}
  247. def
  248. /longText
  249. {
  250.     /theString exch def
  251.     /textY exch def
  252.     /textX exch def
  253.     
  254.     textX textY  theString     PICTshow
  255. }
  256. def
  257. /DHText
  258. {
  259.     /theString exch def
  260.     /deltaX exch def
  261.     
  262.     deltaX textX add textY theString longText
  263. }
  264. def
  265. /DVText
  266. {
  267.     /theString exch def
  268.     /deltaY exch def
  269.     textX deltaY textY add theString longText
  270. }
  271. def
  272. /DHDVText
  273. {
  274.     /theString exch def
  275.     /deltaY exch def
  276.     /deltaX exch def
  277.     
  278.     deltaX textX add   deltaY textY add  theString longText
  279. }
  280. def
  281. /fontName
  282.     { txFont }
  283. def
  284. /lineJustify
  285. {
  286.     pop
  287.     /extraCharWidth exch def 
  288. }
  289. def
  290. %END Text
  291.